package com.wandian.ui.controls
{
	import flash.events.FocusEvent;
	import flash.text.TextField;
	import flash.text.TextFormat;
	

	public class TextInput extends Label
	{
		

		public function TextInput(w:int=150, h:int=30)
		{
			super(w, h);

		}

		override protected function createChildren():void
		{
			super.createChildren()
			textField.selectable=true;
			textField.type="input";
			textField.addEventListener(FocusEvent.FOCUS_IN, focusHandler)
			textField.addEventListener(FocusEvent.FOCUS_OUT, focusHandler)
		}

		private function focusHandler(e:FocusEvent):void
		{
			if (e.type == FocusEvent.FOCUS_IN)
			{
				skin.updateDisplay(width, height, "focusIn");
			}
			else
			{
				skin.updateDisplay(width, height, "focusOut");
			}
		}


		public function get displayAsPassword():Boolean
		{
			return textField.displayAsPassword;
		}

		public function set displayAsPassword(f:Boolean):void
		{
			textField.displayAsPassword=f;
		}
		

	}
}
